package com.spring.shops.admin.controller.product;

import com.spring.shops.model.entity.TzProdPropValue;
import com.spring.shops.model.result.ServerResponseEntityVoid;
import com.spring.shops.model.vo.ProdPropVO;
import com.spring.shops.model.vo.ProdPropVO3;
import com.spring.shops.service.ProdPropService;
import com.spring.shops.service.ProdPropService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
//产品管理->产品属性模块
@RestController
@RequestMapping("/prod/spec")
public class ProdSpecController {
    @Autowired
    private ProdPropService2 service;
    /**
     * 列出产品的所有属性
     * @return
     */
    @GetMapping("/list")
    public ServerResponseEntityVoid<List<ProdPropVO3>> listSpec(){
        return service.listSpec();
    }

    /**
     * 根据产品属性id获取产品属性的所有值
     * @param specId
     */
    @GetMapping("/listSpecValue/{specId}")
    public ServerResponseEntityVoid<List<TzProdPropValue>> getSpecValuesById(@PathVariable Integer specId){
        return service.getSpecValuesById(specId);
    }
    /**
     * 根据产品属性所有值的最大值id
     * @param
     */
    @GetMapping("/listSpecMaxValueId")
    public ServerResponseEntityVoid<Long> listSpecMaxValueId(){
        return service.listSpecMaxValueId();
    }
}
